<template class="all">
	<view class="all">
		<view style="width: 100%; height: 50px;"><text
				style="margin: auto 0px;padding-left: 40%; font-size: 24px; font-weight: bold;text-align: center;">{{inname}}</text>
		</view>
		<view class="foreground">
			<view v-for="(item,i) in picture">
				<image :src="item.goodurl"></image>
			</view>


		</view></br>
		<button type="primary" @click="addprodce" style="width: 80%;
		margin: 10% 10%;">下载图片</button>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				index: "0",
				inname:"",
				good: [],
				picture:[],
				typeList: []
			}
		},
		methods: {
			getculture() {
				uni.request({
					url: this.api.Getpicture,
					method: "GET",
				}).then(data => {
					let [err, res] = data
					this.good = res.data
					console.log(this.good)
					for(let i=0;i<this.good.length;i++){
						if(this.good[i].googId===this.index)
						{this.picture[i]=this.good[i]
						
						}
						else
						console.log("flaot")
					}
					console.log(this.picture)

				})
			},
		getindex(){
			uni.request({
				url: this.api.commodity,
				method: "GET",
			}).then(data => {
				let [err, res] = data
				this.typeList = res.data
				console.log(res.data)
				for(let i=0;i<this.typeList.length;i++){
					if(this.typeList[i].googId===this.index){
						this.inname=this.typeList[i].googname;
						break;
					}
				}
				
			})
		}
		},
		onLoad(e) {
			this.getculture()
			this.getindex()
			if (e.id) {
				this.index = e.id
				
				console.log(this.index)
			}
		}
	}
</script>

<style>
	.all {
		/* background-color: #000000; */
	}

	.foreground {
		/* width: 90px; */
		align-content: center;
		background-color: #000000;
		height: 100%;
	}

	image {
		/* display: block; */
		/* margin: 50%; */
		width: 80%;
		margin: 10px 10%;
		/* height: 80%; */
		/* padding-left: 50%; */
		/* align-content: center; */
		/* margin: 0 auto; */
		float: left;

	}

	.text {
		font-size: 24px;
		/* 		float: left;
		display: flex;
		margin: 0px auto; */
	}
</style>
